import Vue from 'vue'
import Router from 'vue-router'



const  index = () => import('../views/index/Index')
const  dynamic = () => import('../views/index/Dynamic')
const  service = () => import('../views/index/Service')
const  newNotice = () => import('../views/index/NewNotice')
const  aboutMe = () => import('../views/index/AboutMe')
const  linkMe = () => import('../views/index/LinkMe')


const  Content = () => import('../views/content/Content')

Vue.use(Router)

const routes = [
    {
        path: '/',
        redirect: '/index'
    }, {
        path: '/index',
        name: "首页",
        component: index,
    },
    {
        path: '/dynamic',
        name: "公司动态",
        component: dynamic,
    },
    {
        path: '/service',
        name: "服务行业",
        component: service,
    },
    {
        path: '/newNotice',
        name: "新闻公告",
        component: newNotice,
    },
    {
        path: '/aboutMe',
        name: "关于我们",
        component: aboutMe,
    },
    {
        path: '/linkMe',
        name: "联系我们",
        component: linkMe,
    },
    {
        path: '/content',
        name: "文章",
        component: Content,
    }
]


const router = new Router({
    routes,
    mode: 'history'
})

// 解决重复点击导航路由报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}


router.beforeEach((to,from,next)=>{
   next()
})



router.afterEach((to, from) => {

})

export default router
